feat(vault): async withdrawal queue for illiquid exits#13
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tier 3 — asynchronous withdrawal queue. Gives users an exit path when the vault lacks idle liquidity to satisfy a synchronous ERC-4626
withdraw/redeem(notably when capital sits in an illiquid strategy like Pendle PT before maturity). The requester escrows shares; a curator/keeper frees liquidity viarebalance, then fulfils the claim at the live share price.Design
LibWithdrawQueue— namespaced storage (nextRequestId,requests,totalPendingShares).Vault(native) —requestWithdraw/cancelWithdraw/fulfillWithdraw. These are native (not on the facet) because only the native ERC-4626 surface can_transfer/_burnshares; a facet would need an approve-dance and lose the user'smsg.sender. Mirrors the existing Lib-storage + native-enforcement + facet-readers pattern.WithdrawQueueFacet— readers (nextWithdrawRequestId,pendingWithdrawShares,withdrawRequest).Key choices
fulfillWithdrawis curator-gated (LibRoles),nonReentrant, honors the circuit breaker, accrues fees first, revertsInsufficientIdleLiquiditywhen idle is short (CEI: effects + burn before transfer).withdraw/redeemare unchanged (only illiquid exits queue).Verification
forge buildclean,forge fmtclean.forge test --no-match-path 'test/integration/*'→ 158 passed, 0 failed (+12 new, incl.test_IlliquidExit_FreedByRebalanceThenFulfilled).diamond-detect→ no storage collisions, 10 namespaced regions each on its own slot.